<?php 
class XUtility
{
	function __construct()
	{
	}
	
	public function reboot()
	{
		exec("/usr/sbin/reboot");
	}
	public function setDefault() 
	{
		exec("/bin/sh /opt/S99WebSettingReset");
	}
	
	public function createHtmlImageDir($in_file) 
	{
		if (''==$in_file) 
			return -1;
		$filepath = pathinfo($in_file);
		$filename = $filepath['filename'];
		$image_dir = "/media/sd/htmls/".$filename."_image";
		
		if (!is_dir($image_dir)) {
			if (!mkdir($image_dir, 0700)) {
				return -1;
			}
		}
	}
	
	public function deleteHtmlFileWithImages($in_file)
	{
		if (''==$in_file) 
			return -1;
		$html_path = '/media/sd/htmls/'.$in_file;
		unlink($html_path);
		
		$fileinfo = pathinfo($in_file);
		$basename = $fileinfo['filename'];
		$image_path = '/media/sd/htmls/'.$basename.'_image';
		$remove_command = '/bin/rm -rf '.$image_path;
		exec($remove_command);
	}

	public function deleteMovie($in_file)
	{
		if (''==$in_file)
			return -1;
		$movie_path = '/media/sd/movies/'.$in_file;
		unlink($movie_path);
	}
}
//$xUtility = new XUtility();
//$xUtility->reboot();
?>
